<template>
  <div class="box"></div>
  <block v-for="(item, index) in c">
    <input type="text" v-model="item.a" />
    <div v-if="item.show(c)">内容{{ item.a }}</div>
  </block>
  <button @click="add">添加</button>
</template>
<script>
import moment from 'moment'
import 'moment/locale/zh-cn.js'
export default {
  data() {
    return {
      a: 1,
      b: 2,
      c: [
        {
          show() {},
          testObj: {
            a: 1,
            b: 2
          }
        },
        {
          a: 2,
          b: 999,
          show(c) {
            console.log(c)
            let item = c.find((res) => res.testObj)
            console.log(item.testObj.a, 'a')
            console.log(this)
            return this.a == 1
          }
        }
      ]
    }
  },
  methods: {
    add() {
      console.log(`helloworld`)
    }
  }
}
</script>
<style type="text/css">
.box {
  width: 100px;
  height: 100px;
  border: 1px solid #000;
}
</style>
